package project.model;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;


@Table(name="room_categories")
@Entity
public class RoomCategory {

	@Id
	@Column(name="room_category_id")
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;

	@Column(name="name",unique=true,nullable=false,length=128)
	private String name;

	@Column(name="description",length=2048)
	private String description;
	
	//in mysql database there's a column named pricing_id in table pricings as its foreign key
	//pointing to the primary key of this table room_categories
	//@JoinColumn(name="pricing_id",referencedColumnName="room_category_id",unique=true,nullable=false,updatable=true)

//	private Pricing pricing;
	
	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @return the pricing
	 */
//	@OneToOne(cascade=CascadeType.ALL)
//	public Pricing getPricing() {
//		return pricing;
//	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @param pricing the pricing to set
	 */
//	public void setPricing(Pricing pricing) {
//		this.pricing = pricing;
//	}

	@Override
	public String toString(){
		return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
	}
}
